<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<title></title>
<div id="app">
	<input v-model="msg">
	<!-- <button @click="show">显示</button> -->
	<button-click v-bind:childmsg='msg'></button-click>
	
</div>

</head>
<body>
	<script>
// component!=comment 看清楚
    Vue.component('button-click',{
		props:["childmsg"],
		template:'<button @click="childshow">显示</button>',
		methods:{
			childshow:function(){
				alert(this.childmsg)
			}
		}
	})
	new Vue({
		el:"#app",
		data:{
			msg:"你好"
		},
		methods:{
			show:function(){
				alert(this.msg)
			}
		}
	})
				
</script>
	
</body>
</html>
